package com.bitdf.txing.users.service.impl;

import com.bitdf.txing.users.entity.UserRolePermRelateEntity;
import com.bitdf.txing.users.vo.UserPermissionQueryVo;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bitdf.txing.common.utils.PageUtils;
import com.bitdf.txing.common.utils.Query;

import com.bitdf.txing.users.dao.UserPermissionDao;
import com.bitdf.txing.users.entity.UserPermissionEntity;
import com.bitdf.txing.users.service.UserPermissionService;


@Service("userPermissionService")
public class UserPermissionServiceImpl extends ServiceImpl<UserPermissionDao, UserPermissionEntity> implements UserPermissionService {

    @Override
    public PageUtils queryPage(UserPermissionQueryVo queryVo) {
        QueryWrapper<UserPermissionEntity> wrapper = new QueryWrapper<>();
        wrapper.lambda().like(queryVo.getName() != null, UserPermissionEntity::getName, "%" + queryVo.getName() + "%");

        IPage<UserPermissionEntity> page = this.page(
                new Query<UserPermissionEntity>().getPage(queryVo),
                wrapper
        );
        return new PageUtils(page);
    }
}